package com.awspaas.user.apps.jichusuo.maintenance;


	import java.util.List;
import java.util.Map;

import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
import com.actionsoft.bpms.bpmn.engine.listener.InterruptListener;
import com.actionsoft.bpms.bpmn.engine.listener.InterruptListenerInterface;
import com.actionsoft.bpms.commons.database.ColumnMapRowMapper;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.exception.BPMNError;
import com.awspaas.user.apps.shhtaerospaceindustrial.util.CoreUtil;

	public class checkMaintenRealityMoney extends InterruptListener  implements InterruptListenerInterface{

		@Override
		public String getDescription() {
			return "运管处主管实施情况提交时，检验“实施费用”是否填写！";
		}
		
		@Override
		public String getProvider() {
			return "Actionsoft";
		}
		
		@Override
		public String getVersion() {
			return "1.0";
		}
		
		@Override
		public boolean execute(ProcessExecutionContext param) throws Exception {
			// 记录ID
			String processInstId = param.getProcessInstance().getId();
			//根据流程实例ID获取任务表内数据
			List<Map<String , Object>> list = DBSql.query("SELECT ESTIMATECOST FROM BO_EU_ASSURESERVICE  "
					+ "WHERE BINDID = ? ", new ColumnMapRowMapper(), new Object[] {processInstId});
			Map<String , Object>  datarecord = list.get(0);
			String ESTIMATECOST =CoreUtil.objToStr(datarecord.get("ESTIMATECOST"));// 实施预算
			if ("".equals(ESTIMATECOST) ||"0".equals(ESTIMATECOST)) {
				
				throw new BPMNError("“实施费用”不能为空，请填写后才能提交！");
				
			} 
			return true;
		}

	}
